#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QModbusDevice>
#include <QModbusTcpClient>
#include <QModbusDataUnit>

#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private Q_SLOTS:
    void state_change_slot(QModbusDevice::State state);//连接状态改变

    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void onReadReady();

    void on_pushButton_7_clicked();

    void on_pushButton_6_clicked();

private:

    void connectModbusDevice();

    void redxianquanData();

    void redlisaninputData();

    void redinputjicunqiData();

    void redsavejicunqiData();

    bool m_isConnect = false;

    Ui::MainWindow *ui;

    QModbusTcpClient *m_client;
};
#endif // MAINWINDOW_H
